package net.oktaeder.office.utils.ordertransformer;

import java.util.ArrayList;
import java.util.Hashtable;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import net.oktaeder.office.model.WorkOrder;
import net.oktaeder.office.model.WorkOrderData.OrderType;
import net.oktaeder.office.view.Mail;

/**
 * Class to transform mails to labour market
 * 
 * @author tuukka
 *
 */
public class LabourMarketMailTransformer implements IMailTransformer {

	private static Log log = LogFactory.getLog(LabourMarketMailTransformer.class);
	
	public Hashtable<String, ArrayList<WorkOrder>> TransformMail(Mail mail) {
		WorkOrder tempOrder;
		Hashtable<String, ArrayList<WorkOrder>> orders;
		ArrayList<WorkOrder> workOrders;
		
		orders = new Hashtable<String, ArrayList<WorkOrder>>();
		workOrders = new ArrayList<WorkOrder>();
			
		if (mail.getMessage().contains("list")) {
			tempOrder = new WorkOrder();
			tempOrder.setOrderType(OrderType.LabourMarketOrder);
			tempOrder.addValue("action", "list");
			workOrders.add(tempOrder);
		}

		orders.put("labour-market", workOrders);
		
		//TODO: implement rest
		log.warn("special case handling not implemented");
		return orders;		
	}

}
